import unittest
import interf
import calc

class SmithWatermanTestCase(unittest.TestCase):
    def setUp(self):
        return

    def test01AddRemoveSequence(self):
        sequences = interf.readSequences()
        self.assertEquels(len(sequences), 0)

        sequence_id = interf.addSequence("test", "ACGT")
        
        sequences = interf.readSequences()
        self.assertEquals(len(sequences), 1)

        interf.delBackpack(sequences_id)

        sequences = interf.readSequences()
        self.assertEquels(len(sequences), 0)

    def test02DetailsSequences(self):
        sequence_id = interf.addSequence("test", "ACGT")

        detail = interf.readSequencesDetails(sequence_id)

        self.assertEqual(details['name'], 'test')
        self.assertEqual(details['sequence'], 'ACGT')

        interf.delSequence(sequence_id)

    def test03AddDeleteSimilarityMatrixElemets(self):
        matrix_len = interf.readSimilarityMatrixNumber()
        self.assertEqual(matrix_len, 0)

        matrix_id = interf.addSimilarityMatrix()
        matrix_len = interf.readSimilarityMatrixNumber()
        self.assertEqual(matrix_len, 1)
        
        for i in range(1, 16):
            interf.addSimilarityMatrixElement(matrix_id, i)
        
        matrix = interf.readSimilarityMatrixDetails(matrix_id)
        self.assertEquals(len(matrix), 16)

        interf.delSimilarityMatrix(matrix_id)
        matrix_len = interf.readSimilarityMatrixNumber()
        self.assertEqual(matrix_len, 0)

if __name__ == '__main__':
    unittest.main()
